﻿@{
    ViewBag.Title = "冲压件寄售货存台账";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<link href="~/Content/css/ConsignmentLegter_print.css" rel="stylesheet" media="print" />
<style type="text/css">
    .print {
        display: none;
    }

    .tool_c {
        padding: 10px 0;
    }

    .btn-group {
        padding: 0 10px 0 0;
    }


    .grid_list_1_c table tr[id] td:nth-child(2) a {
        margin: 0 0.5em 0 0;
    }


    .btn-group:last-child a.btn:first-child {
        margin: 0 0.5em 0 0 !important;
    }

    .input_inline input {
        display: inline-block;
        width: 4em;
    }

    .date_area input {
        display: inline-block;
        width: 8em !important;
        margin: 0 0.2em;
    }


    .btn-group input[type=text] {
        height: 2em !important;
    }
</style>
<script>
    $(function () {
        Index.init();
    });

    var Index = {
        defaultDate:@Html.Raw(ViewData["LedgerDate"].ToString()),
        printTemplate: null,
        titlies: "{0}库存明细表,{0}单据档案表,{0}出入库对比".split(","),
        curUnit: '@ViewData["curUnit"].ToString()',
        curUserName: '@ViewData["curUserName"].ToString()',
        curDate: '@ViewData["curDate"].ToString()',
        curTime: '@ViewData["curTime"].ToString()',
        dataList:{
            "0":null,
            "1":null,
            "21":null,
            "22":null
        },
        printItemTemplate: "",
        init: function () {
            with (Index) {
                printItemTemplate = $("#print1 .page").html();

                initControl();

                loadDataList();
            }
        },
        initControl: function () {
            $.renderMy97Datepicker();

            $("[date-control]").val(Index.defaultDate);

            $("[date-control]").on("click", function () {
                WdatePicker({ dateFmt: 'yyyyMM', minDate: '2000-1', maxDate: '2050-12' });
            });

            $('select').bindSelect();

            $("#FProductionTypeNO1").bindSelect({
                url: "/WareHouse/Consignment/GetFProductionTypies",
                id: "FTypeNO",
                text: "FTypeNOName"
            });
            //批次查询 btn_search1
            $("#btn_search1").on("click", function () {
                var $gridList1 = $("#gridList1");

                var conn1 = $.buildPostParam("FAccountDate,FProductionNO,FProductionTypeNO", "1");

                $gridList1.jqGrid('setGridParam', {
                    postData: conn1,
                }).trigger('reloadGrid');
            });
            //打印      
            $("#butnPrint1").on("click", function () {
                $("#print1").jqprint();
            });
            //导出
            $("#butnExport1").on("click", function () {
                var param = { id: "V_JSK_21_KC_StoLJKStockCata", param: Index.buildExportConn("FAccountDate,FProductionNO,FProductionTypeNO".split(","), "1") };

                Index.defaultDate != $("#FAccountDate1").val() && (param.id = "V_JSK_22_KC_StoLJKStockCata_Arc");

                var url = "/Common/ExcelExportById?{0}".format($.param(param));

                location.href = url;
            });
            
            $("#gridList1").delegate("a[明细账页]","click",function(){
                var num = $.trim($(this).parents("tr").attr("id"));

                var r = {};

                var cols = "FProductionNO,FProductionName,FPrice,FAccountDate,UseUnit,FProductionTypeName".split(",");
                
                cols.forEach(function(col){
                    col in Index.dataList["0"][num-1] && (r[col] = Index.dataList["0"][num-1][col]);
                });
                
                var jsonData = {param:JSON.stringify(r),FAccountDate:Index.defaultDate};
                
                var url = "/WareHouse/Consignment/ConsignmentLedgerDetails?{0}".format($.param(jsonData));

                location.href = url;
            });
            
            $("#gridList1").delegate("a[统计台账]","click",function(){
                var num = $.trim($(this).parents("tr").find("td:first").text());

                var r = {};

                var cols = "FProductionNO,FProductionName,FPrice,FAccountDate,UseUnit,FProductionTypeName".split(",");

                cols.forEach(function(col){
                    col in Index.dataList[num-1] && (r[col] = Index.dataList[num-1][col]);
                });

                var jsonData = {param:JSON.stringify(r),FAccountDate:Index.defaultDate};
                
                var url = "/WareHouse/Consignment/ConsignmentLedgerStatistics?{0}".format($.param(jsonData));

                location.href = url;
            });
            //绑定发生方式 
            $("#FDocuTypeName2").bindSelect({ 
                url: "/WareHouse/Consignment/GetDocuTypies",
                id: "FTypeNO",
                text: "FTypeNOName"
            });
            //绑定发生单位
            $("#FHappenComNO2").bindSelect({
                url: "/WareHouse/Consignment/GetHappenComs",
                id: "UnitNO",
                text: "UnitNOName"
            });
            //批次查询 btn_search1
            $("#btn_search2").on("click", function () {
                var $gridList2 = $("#gridList2");

                var conn2 = $.buildPostParam("FDocuTypeName,FDocuNO,FHappenComNO,FCurDate,FProductionNO,FCredence", "2");

                conn2["FCurDates"] = $("#FCurDate2s").val();

                $gridList2.jqGrid('setGridParam', {
                    postData: conn2,
                }).trigger('reloadGrid');
            });
            //打印      
            $("#butnPrint2").on("click", function () {
                $("#print2").jqprint();
            });
            //导出
            $("#butnExport2").on("click", function () {
                var param = { id: "V_JSK_14_MX_StoLJKListAcco_Mid_UNION", param: Index.buildExportConn("FDocuTypeName,FDocuNO,FHappenComNO,FCurDate,FProductionNO,FCredence".split(","), "2") };

                var url = "/Common/ExcelExportById?{0}".format($.param(param));

                location.href = url;
            });

            var show3s = {
                "入库":"i32,i33,i34,i35,i36".split(","),
                "出库":"i32,i33,i34,i35,i37".split(",")
            };

            $("[name=ra3]").on("click",function(){
                var showCur = show3s[$(this).val()];

                $(".i3").hide(0);

                showCur.forEach(function(cur){
                    $(".{0}".format(cur)).show(0);
                });
            });

            $("[name=ra3]:first").trigger("click");
            //批次查询 btn_search1
            $("#btn_search3").on("click", function () {
                var conn3 = $.buildPostParam("FCurDate,SJDH,LBJH,RKCY", "3");

                conn3["FCurDates"] = $("#FCurDate3s").val();

                var val = $("[name=ra3]:checked").val();

                "入库"==val &&(function(){
                    var $gridList31 = $("#gridList31");

                    $gridList31.jqGrid('setGridParam', {
                        postData: conn3,
                    }).trigger('reloadGrid');
                })();

                "出库"==val &&(function(){
                    var $gridList32 = $("#gridList32");

                    $gridList32.jqGrid('setGridParam', {
                        postData: conn3,
                    }).trigger('reloadGrid');
                })();
                
            });
            //导出
            $("#butnExport3").on("click", function () {
                var val = $("[name=ra3]:checked").val();

                var param = { id: "", param: (function(params,fixed,ex){
                    var cols = params.split(",");

                    var result = "";

                    var RKCYS = " ,AND RKCY <>0,  AND RKCY =0 ".split(',');

                    ("" != $("#{0}{1}".format(cols[0], fixed)).val() && "" != $("#{0}".format(ex)).val()) &&
                    (result += "and RKRQ >='{0}' AND  RKRQ <='{1}'".format($("#{0}{1}".format(cols[0], fixed)).val(),$("#{0}".format(ex)).val()));
                    
                    "" != $("#{0}{1}".format(cols[1], fixed)).val() &&
                    (result += ("and {0} = '{1}'".format(cols[1], $("#{0}{1}".format(cols[1], fixed)).val())));

                    "" != $("#{0}{1}".format(cols[2], fixed)).val() &&
                    (result += ("and {0} = '{1}'".format(cols[2], $("#{0}{1}".format(cols[2], fixed)).val())));

                    result += RKCYS[$("#{0}{1}".format(cols[3], fixed)).val()];

                    return result;
                })("FCurDate,SJDH,LBJH,RKCY","3","FCurDate3s")};

                "入库"==val &&(function(){
                    param.id = "V_JSK_22_CS_CWHZDZB";
                })();

                "出库"==val &&(function(){
                    param.id = "V_JSK_22_CS_CWHZDZB2";
                })();

                var url = "/Common/ExcelExportById?{0}".format($.param(param));

                location.href = url;
            });
            //输入
            $("#butnInput3").on("click", function () {
                var val = $("[name=ra3]:checked").val();

                var num = 0,curIndex="21";

                var selected = {};

                var sCols = "SJDH,LBJH,BSZM".split(",");

                var detailUrl = "ConsignmentCommentIn";

                var addUrl = "AddConsignmentCommentIn";

                "入库"==val &&(function(){
                    num = $("#gridList31").jqGrid("getGridParam", "selrow");
                    curIndex="21"

                    sCols[2] = "{0}1".format(sCols[2]);

                    detailUrl = "ConsignmentCommentIn";

                    addUrl = "AddConsignmentCommentIn";
                })();

                "出库"==val &&(function(){
                    num = $("#gridList32").jqGrid("getGridParam", "selrow");
                    curIndex="22"

                    sCols[2] = "{0}2".format(sCols[2]);

                    detailUrl = "ConsignmentCommentOut";

                    addUrl = "AddConsignmentCommentOut";
                })();

                var selected = {},sparam={};
                

                !!num || $.modalAlert("请先选择数据");

                !!num && (function () {
                    selected = Index.dataList[curIndex][num - 1];

                    sCols.forEach(function(sCol){
                        sCol in selected && (sparam[sCol]=selected[sCol]);
                    });
                   
                })();

                var url = "/WareHouse/Consignment/{1}?{0}";

                url = url.format($.param(sparam),detailUrl);

                $.modalOpen({
                    url: url,
                    width: "640px",
                    height: "240px",
                    close: true,
                    btn: ["确定","关闭"],
                    id:"dlgConsignmentCommentAdd",
                    callBack: function (id,isCancel) {
                        !isCancel && (function(){
                            var postData = {};

                            var cc = parent.parent.$("#{0}".format(id)).find("iframe").contents();
                        
                            sCols.forEach(function (item) {
                                postData[item] = cc.find("#{0}".format(item)).val();
                            });

                            $.post("/WareHouse/Consignment/{0}".format(addUrl), postData, function (res) {
                                !!parseInt(res,10) && (function () {
                                    0 < parseInt(res,10) && $("#btn_search3").trigger("click");
                                })();
                            });
                        })();
                       
                    }
                });
               
            });
        },
        buildExportConn: function (params, num) {
            var conn = "";

            !num && (num = "");

            params.forEach(function (item) {
                var val = $("#{0}{1}".format(item, num)).val();

                !!val && (conn += ("and {0} = '{1}'".format(item, val)));
            });

            return conn;
        },
        loadDataList: function () {
            var conn1 = $.buildPostParam("FAccountDate,FProductionNO,FProductionTypeNO", "1");

            var $gridList1 = $("#gridList1");///BOM/Blankingcard/GetBlankingcards

            var buildOperate = function(cellvalue, options, rowObject){
                var template = "<a href=\"javascript:void(0);\" 明细账页>明细账页</a><a href=\"javascript:void(0);\" 统计台账>统计台账</a>";

                return template;
            }

            $gridList1.dataGridForJson({
                url: "/WareHouse/Consignment/GetConsignmentSADetails",
                postData: conn1,
                height: $(window).height() - 240,
                colModel: [
                { label: '操作', name: 'FStockCataID', width: 160, align: 'center', formatter: buildOperate},
                { label: '单位(隐藏)', name: 'UseUnit', width: 100, align: 'center', sortable: false, hidden: true  },
                { label: '台账日期(隐藏)', name: 'FAccountDate', width: 100, align: 'center', sortable: false, hidden: true  },
                { label: '单位', name: 'UseUnitName', width: 140, align: 'left', sortable: false },
                { label: '零件编号', name: 'FProductionNO', width: 120, align: 'left', sortable: false},
                { label: '零件名称', name: 'FProductionName', width: 160, align: 'left', sortable: false},
                { label: '即时库存', name: 'FImmeQuantity', width: 80, align: 'right', sortable: false },
                { label: '账面库存', name: 'FBookQuantity', width: 80, align: 'right', sortable: false },
                { label: '单价<br/>(元)', name: 'FPrice', width: 60, align: 'right', sortable: false, formatter: 'number' },
                { label: '账面金额<br/>(元)', name: 'FMoney', width: 80, align: 'right', sortable: false, formatter: 'number' },
                { label: '制造单位', name: 'FProCompanyNO', width: 120, align: 'left', sortable: false },
                { label: '制造单位名称', name: 'FProCompanyName', width: 160, align: 'left', sortable: false },
                { label: '（隐藏）	分类编码', name: 'FProductionTypeNO', width: 100, align: 'left', sortable: false, hidden: true },
                { label: '零件分类', name: 'FProductionTypeName', width: 100, align: 'center', sortable: false },
                 { label: '', name: '', width: $(window).width() - 1350, align: 'left' }
                ],
                pager: "#gridPager1",
                sortname: 'FProductionNO',
                sortorder: "asc",
                viewrecords: true,
                rownumWidth: 50,
                onSelectRow: function (rowId) {

                },
                loadComplete: function (data) {
                    Index.dataList["0"] = data.rows;

                    var columnInfo = [
                              { caption: '单位', name: 'UseUnitName'},
                              { caption: '零件编号', name: 'FProductionNO'},
                              { caption: '零件名称', name: 'FProductionName'},
                              { caption: '即时库存', name: 'FImmeQuantity'},
                              { caption: '账面库存', name: 'FBookQuantity'},
                              { caption: '单价<br/>(元)', name: 'FPrice'},
                              { caption: '账面金额<br/>(元)', name: 'FMoney'},
                              { caption: '制造单位', name: 'FProCompanyNO'},
                              { caption: '制造单位名称', name: 'FProCompanyName'},
                              { caption: '零件分类', name: 'FProductionTypeName'}
                    ];

                    var title = Index.titlies[0].format(new Date().format("yyyy年MM月"))

                    Index.renderPrintData($("#print1"), data.rows, columnInfo, title);
                }
            });

            $gridList1.jqGrid('setFrozenColumns');

            $gridList1.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
            
            var conn2 = $.buildPostParam("FDocuTypeName,FDocuNO,FHappenComNO,FCurDate,FProductionNO,FCredence", "2");

            conn2["FCurDates"] = $("#FCurDate2s").val();

            var $gridList2 = $("#gridList2");

            $gridList2.dataGridForJson({
                url: "/WareHouse/Consignment/GetConsignmentExchangeArchivies",
                postData: conn2,
                height: $(window).height() - 240,
                colModel: [
                { label: '发生方式', name: 'FDocuTypeName', width: 100, align: 'center', sortable: false },
                { label: '单据编号', name: 'FDocuNO', width: 140, align: 'center', sortable: false },
                { label: '发生单位', name: 'FHappenComNO', width: 80, align: 'left', sortable: false },
                { label: '发生单位名称', name: 'FHappenComName', width: 160, align: 'left', sortable: false},
                { label: '单据日期', name: 'FCurDate', width: 80, align: 'left', sortable: false},
                { label: '零件编号', name: 'FProductionNO', width: 140, align: 'left', sortable: false },
                { label: '零件名称', name: 'FProductionName', width: 160, align: 'left', sortable: false },
                { label: '开票<br/>数量', name: 'FQuantity_KP', width: 60, align: 'right', sortable: false},
                { label: '实际<br/>数量', name: 'FQuantity', width: 80, align: 'right', sortable: false},
                { label: '单价<br/>(元)', name: 'FPrice', width: 60, align: 'right', sortable: false, formatter: 'number'},
                { label: '金额<br/>(元)', name: 'FAmount', width: 80, align: 'right', sortable: false, formatter: 'number' },
                { label: '仓库编号', name: 'FStoreNO', width: 80, align: 'left', sortable: false },
                { label: '仓库名称', name: 'FStoreName', width: 120, align: 'left', sortable: false },
                { label: '输入人员', name: 'FCreateBy', width: 80, align: 'center', sortable: false },
                { label: '输入日期', name: 'FCreateDate', width: 80, align: 'center', sortable: false},
                { label: '输入时间', name: 'FCreateTime', width: 80, align: 'center', sortable: false },
                { label: '审核人员', name: 'FAuditingBy', width: 80, align: 'center', sortable: false },
                { label: '审核日期', name: 'FAuditingDate', width: 80, align: 'center', sortable: false },
                { label: '审核时间', name: 'FAuditingTime', width: 80, align: 'center', sortable: false }
                ],
                pager: "#gridPager2",
                sortname: 'UseUnit,FProductionNO',
                sortorder: "asc,asc",
                viewrecords: true,
                rownumWidth: 50,
                onSelectRow: function (rowId) {

                },
                loadComplete: function (data) {
                    Index.dataList["1"] = data.rows;

                    var columnInfo = [
                              { caption: '发生方式', name: 'FDocuTypeName'},
                              { caption: '单据编号', name: 'FDocuNO'},
                              { caption: '发生单位', name: 'FHappenComNO'},
                              { caption: '发生单位名称', name: 'FHappenComName'},
                              { caption: '单据日期', name: 'FCurDate'},
                              { caption: '零件编号', name: 'FProductionNO'},
                              { caption: '零件名称', name: 'FProductionName'},
                              { caption: '开票<br/>数量', name: 'FQuantity_KP'},
                              { caption: '实际<br/>数量', name: 'FQuantity'},
                             { caption: '单价<br/>(元)', name: 'FPrice'},
                              { caption: '金额<br/>(元)', name: 'FAmount'},
                                { caption: '仓库名称', name: 'FStoreName'}
                    ];

                    var title = Index.titlies[1].format(new Date().format("yyyy年MM月"))

                    Index.renderPrintData($("#print2"), data.rows, columnInfo, title);
                }
            });

            $gridList2.jqGrid('setFrozenColumns');

            $gridList2.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');

            var conn3 = $.buildPostParam("FCurDate,SJDH,LBJH,RKCY", "3");

            conn3["FCurDates"] = $("#FCurDate3s").val();

            var $gridList31 = $("#gridList31");

            $gridList31.dataGridForJson({
                url: "/WareHouse/Consignment/GetConsignmentInStockComparies",
                postData: conn3,
                height: $(window).height() - 240,
                colModel: [
                { label: '入库单号', name: 'RKBH', width: 120, align: 'left', sortable: false },
                { label: '送检单号', name: 'SJDH', width: 120, align: 'left', sortable: false },
                { label: '入库日期', name: 'RKRQ', width: 80, align: 'center', sortable: false },
                { label: '零件编号', name: 'LBJH', width: 120, align: 'left', sortable: false},
                { label: '零件名称', name: 'LJMC', width: 180, align: 'left', sortable: false},
                { label: '入库<br/>数量', name: 'RKSL', width: 60, align: 'right', sortable: false },
                { label: '结算<br/>单价', name: 'RKDJ', width: 60, align: 'right', sortable: false },
                { label: '结算<br/>金额', name: 'RKDJ_X_RKSL', width: 60, align: 'right', sortable: false, formatter: 'number'},
                { label: '产品线', name: '不绑定', width: 80, align: 'left', sortable: false},
                { label: '出库单号', name: 'CKBH', width: 140, align: 'left', sortable: false},
                { label: '出库<br/>数量', name: 'CKSL', width: 60, align: 'right', sortable: false },
                { label: '出库日期', name: 'CKRQ', width: 80, align: 'center', sortable: false },
                { label: '差异', name: 'RKSL_CKSL', width: 60, align: 'right', sortable: false },
                { label: '备注说明', name: 'BSZM1', width: 220, align: 'center', sortable: false },
                { label: '操作<br/>人员', name: 'CZRY1', width: 60, align: 'center', sortable: false},
                { label: '操作<br/>日期', name: 'SRRQ1', width: 60, align: 'center', sortable: false },
                { label: '操作<br/>时间', name: 'SRSJ1', width: 60, align: 'center', sortable: false },
                 { label: '', name: '', width: $(window).width() - 1650, align: 'left' }
                ],
                pager: "#gridPager31",
                sortname: 'RKRQ,LBJH',
                sortorder: "asc,asc",
                viewrecords: true,
                rownumWidth: 50,
                onSelectRow: function (rowId) {

                },
                loadComplete: function (data) {
                    Index.dataList["21"] = data.rows;
                }
            });

            $gridList31.jqGrid('setFrozenColumns');

            $gridList31.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');

            var $gridList32 = $("#gridList32");

            $gridList32.dataGridForJson({
                url: "/WareHouse/Consignment/GetConsignmentOutStockComparies",
                postData: conn3,
                height: $(window).height() - 240,
                colModel: [
                { label: '送检单号', name: 'SJDH', width: 120, align: 'left', sortable: false },
                { label: '单据编号', name: 'CKBH', width: 120, align: 'left', sortable: false },
                { label: '发往单位', name: 'FSDWMC', width: 120, align: 'left', sortable: false },
                { label: '出库日期', name: 'CKRQ', width: 80, align: 'center', sortable: false},
                { label: '凭证编号', name: 'PZBH', width: 180, align: 'left', sortable: false},
                { label: '零件编号', name: 'LBJH', width: 120, align: 'left', sortable: false },
                { label: '零件名称', name: 'LJMC', width: 160, align: 'left', sortable: false },
                { label: '供货单位', name: 'GHDWMC', width: 120, align: 'left', sortable: false },
                { label: '发出量', name: 'CKSL', width: 60, align: 'right', sortable: false},
                { label: '计划单价<br/>(元)', name: 'CKDJ', width: 80, align: 'right', sortable: false, formatter: 'number'},
                { label: '计划金额<br/>(元)', name: 'CKDJ_X_CKSL', width: 80, align: 'right', sortable: false, formatter: 'number'},
                { label: '入库单号', name: 'RKBH', width: 60, align: 'right', sortable: false },
                { label: '入库数量', name: 'RKSL', width: 60, align: 'right', sortable: false },
                { label: '入库时间', name: 'RKRQ', width: 80, align: 'center', sortable: false },
                { label: '差异', name: 'CKSL_RKSL', width: 60, align: 'right', sortable: false },
                { label: '备注说明', name: 'BSZM2', width: 160, align: 'left', sortable: false},
                { label: '操作<br/>人员', name: 'CZRY', width: 60, align: 'center', sortable: false },
                { label: '操作<br/>日期', name: 'SRRQ', width: 60, align: 'center', sortable: false },
                { label: '操作<br/>时间', name: 'SRSJ', width: 60, align: 'center', sortable: false }
                ],
                pager: "#gridPager32",
                sortname: 'RKRQ,LBJH',
                sortorder: "asc,asc",
                viewrecords: true,
                rownumWidth: 50,
                onSelectRow: function (rowId) {

                },
                loadComplete: function (data) {
                    Index.dataList["22"] = data.rows;
                }
            });

            $gridList32.jqGrid('setFrozenColumns');

            $gridList32.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');

        },
        renderPrintData: function (c, data, colunmInfo, title) {
            c.empty();

            var rows = 16;

            var max = data.length;

            var item = { page: 1, maxPage: 1, title: title, unit: Index.curUnit, user: Index.curUserName, date: Index.curDate, time: Index.curTime, table: null };

            var maxPage = Math.ceil(max / rows);

            item.maxPage = maxPage;

            for (var i = 0; i < maxPage; i++) {
                var isFirst = true;

                var start = i * rows, end = (i + 1) * rows;

                end > max && (end = max);

                var table = $("<table>"), pageItem = $("<div>").addClass("page");

                item.page = i + 1;

                for (var j = start; j < end; j++) {
                    var cur = data[j];

                    isFirst && (function () {
                        var title = $("<tr>");

                        for (var idx in colunmInfo) {
                            $("<th>").html(colunmInfo[idx].caption).appendTo(title);
                        }

                        title.appendTo(table);

                        isFirst = false;
                    })();

                    !isFirst && (function () {
                        var row = $("<tr>");

                        for (var idx in colunmInfo) {
                            $("<td>").text(cur[colunmInfo[idx].name]).appendTo(row);
                        }

                        row.appendTo(table);
                    })();
                }

                item.table = "<table>{0}</table>".format(table.html());

                pageItem.html(Index.printItemTemplate.format(item)).appendTo(c);
            }
        }
    };
</script>


<div class="layout" id="layout" style="width: 100%;">
    <ul id="myTab" class="nav nav-tabs" style="margin: 5px 0 0 0">
        <li class="active"><a href="#StockDetails" data-toggle="tab">库存明细</a></li>
        <li><a href="#ExchangeArchive" data-toggle="tab">单据档案</a></li>
        <li><a href="#OutInStockCompare" data-toggle="tab">出入库对比</a></li>
    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade in active" id="StockDetails">
            <div class="tool_c">
                <div class="btn-group  input-width-185">
                    &nbsp;台账日期<br />
                    <input id="FAccountDate1" name="date" type="text" class="txt_common form-control" date-control />
                </div>
                <div class="btn-group input-width-185">
                    &nbsp;零件编号<br />
                    <input id="FProductionNO1" name="" placeholder="" type="text" class="form-control required" />
                </div>
                <div class="btn-group input-width-185">
                    &nbsp;	零件分类<br />
                    <select id="FProductionTypeNO1" name="" class="form-control FHappenCompanyNO">
                        <option value="">==请选择==</option>
                    </select>
                </div>
                <div class="btn-group">
                    <a id="btn_search1" class="btn btn-primary center-block"><span class="glyphicon glyphicon-search"></span>查询</a>
                    <a class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span>&nbsp刷新</a>
                    <a id="butnPrint1" class="btn btn-primary center-block"><span class="glyphicon glyphicon-print"></span>&nbsp打印</a>
                    <a id="butnExport1" class="btn btn-primary center-block"><span class="glyphicon glyphicon-download"></span>&nbsp导出</a>
                </div>
            </div>
            <div class="grid_list_1_c" style="margin-top: 5px;">
                <table id="gridList1"></table>
                <div id="gridPager1"></div>
            </div>
            <div id="print1" class="print">
                <div class="page break_page">
                    <h1>{title}</h1>
                    <div class="top">
                        单位：<div class="unit">{unit}</div>
                        <div class="right_page">第{page}页，共{maxPage}页</div>
                    </div>
                    <div class="table_c">
                        {table}
                    </div>
                    <footer>
                        <span>打印人员：<label>{user}</label></span> <span>打印日期：<label>{date}</label><label>{time}</label></span>
                    </footer>
                </div>
            </div>
        </div>
        <div class="tab-pane fade" id="ExchangeArchive">
            <div class="tool_c">
                <div class="btn-group  input-width-185">
                    &nbsp;发生方式<br />
                    <select id="FDocuTypeName2" name="" class="form-control FHappenCompanyNO">
                        <option value="">==请选择==</option>
                    </select>
                </div>
                <div class="btn-group input-width-85">
                    &nbsp;	单据编号<br />
                    <input id="FDocuNO2" name="" placeholder="" type="text" class="form-control required" />
                </div>
                <div class="btn-group input-width-185">
                    &nbsp;发生单位<br />
                    <select id="FHappenComNO2" name="" class="form-control FHappenCompanyNO">
                        <option value="">==请选择==</option>
                    </select>
                </div>
                <div class="btn-group input-width-85 date_area">
                    &nbsp;	单据日期<br />
                    <input id="FCurDate2" name="" placeholder="" type="text" class="form-control required" my97date="yyyy-MM-dd" />
                    到<input id="FCurDate2s" name="" placeholder="" type="text" class="form-control required" my97date="yyyy-MM-dd" />
                </div>
                <div class="btn-group input-width-185">
                    &nbsp;	零件编号<br />
                    <input id="FProductionNO2" name="" placeholder="" type="text" class="form-control required" />
                </div>
                <div class="btn-group input-width-185">
                    &nbsp;	凭证编号<br />
                    <input id="FCredence2" name="" placeholder="" type="text" class="form-control required" />
                </div>
                <div class="btn-group">
                    <a id="btn_search2" class="btn btn-primary center-block"><span class="glyphicon glyphicon-search"></span>查询</a>
                    <a class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span>&nbsp刷新</a>
                    <a id="butnPrint2" class="btn btn-primary center-block"><span class="glyphicon glyphicon-print"></span>&nbsp打印</a>
                    <a id="butnExport2" class="btn btn-primary center-block"><span class="glyphicon glyphicon-download"></span>&nbsp导出</a>
                </div>
            </div>
            <div class="grid_list_1_c" style="margin-top: 5px;">
                <table id="gridList2"></table>
                <div id="gridPager2"></div>
            </div>
            <div id="print2" class="print">
                <div class="page break_page">
                    <h1>{title}</h1>
                    <div class="top">
                        单位：<div class="unit">{unit}</div>
                        <div class="right_page">第{page}页，共{maxPage}页</div>
                    </div>
                    <div class="table_c">
                        {table}
                    </div>
                    <footer>
                        <span>打印人员：<label>{user}</label></span> <span>打印日期：<label>{date}</label><label>{time}</label></span>
                    </footer>
                </div>
            </div>
        </div>
        <div class="tab-pane fade" id="OutInStockCompare">
            <div class="tool_c">
                <div class="btn-group  input-width-185">
                    <input name="ra3" id="ra31" type="radio" value="入库" /><label for="ra31">入库</label><br />
                    <input name="ra3" id="ra32" type="radio" value="出库" /><label for="ra32">出库</label>
                </div>
                <div class="btn-group input-width-85 i3 i32 date_area">
                    &nbsp;	单据日期<br />
                    <input id="FCurDate3" name="" placeholder="" type="text" class="form-control required" my97date="yyyy-MM-dd" />
                    到<input id="FCurDate3s" name="" placeholder="" type="text" class="form-control required" my97date="yyyy-MM-dd" />
                </div>
                <div class="btn-group input-width-185 i3 i33">
                    &nbsp;	送检编号<br />
                    <input id="SJDH3" name="" placeholder="" type="text" class="form-control required" />
                </div>
                <div class="btn-group input-width-185 i3 i34">
                    &nbsp;	零件编号<br />
                    <input id="LBJH3" name="" placeholder="" type="text" class="form-control required" />
                </div>
                <div class="btn-group input-width-185 i3 i35">
                    &nbsp;	查询类型<br />
                    <select id="RKCY3" name="" class="form-control FHappenCompanyNO">
                        <option value="0">0 全部</option>
                        <option value="1">1 差异</option>
                        <option value="2">2 相同</option>
                    </select>
                </div>
                <div class="btn-group">
                    <a id="btn_search3" class="btn btn-primary center-block"><span class="glyphicon glyphicon-search"></span>查询</a>
                    <a class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span>&nbsp刷新</a>
                    <a id="butnInput3" class="btn btn-primary center-block"><span class="glyphicon glyphicon-print"></span>&nbsp输入</a>
                    <a id="butnExport3" class="btn btn-primary center-block"><span class="glyphicon glyphicon-download"></span>&nbsp导出</a>
                </div>
            </div>
            <div class="grid_list_1_c i3 i36" style="margin-top: 5px;">
                <table id="gridList31"></table>
                <div id="gridPager31"></div>
            </div>
            <div class="grid_list_1_c i3 i37" style="margin-top: 5px;">
                <table id="gridList32"></table>
                <div id="gridPager32"></div>
            </div>
        
        </div>
    </div>
</div>

